maptest is package{

  var H := hash of { "A"->1; "B"->2; "C"->3; "D"->4 };
  
  #mget(?H,?P,?D) ==> H[P] default D;

  main has type action();
  main() do
  {
    BV is H["B"];
    logMsg(info,"get H[B] is $BV");
    assert BV=2;
    
    assert H["D"]=4;
    
    assert H["D"] matches 4;
    
    assert not H["E"] matches _;
    
    try{
      assert H["E"] = 1
    } on abort {
      E do logMsg(info,"We got the exception $E");
    };
    
    H["E"] := 45;
    
    logMsg(info,"$(mget(H,"D", nonInteger))");
    
    logMsg(info,"$(mget(H,"E", nonInteger))");
    
    remove H["A"];
    
    logMsg(info,"$H");
    
    assert not "A" -> _ in H;
    
    if "A"->_ in H then
      logMsg(info,"$H contains A")
    else
      logMsg(info,"$H does not contain A");
      
    if H["A"] matches _ then
      logMsg(info,"$H contains A")
    else
      logMsg(info,"$H does not contain A");
      
    if "D"->_ in H then
      logMsg(info,"$H contains D")
    else
      logMsg(info,"$H does not contain D");
      
    assert "D" -> _ in H;

    for K->V in H do{
	    logMsg(info,"K=$K, V=$V");
    }
  }
}